unit U_fm_pesq_for;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Vcl.Grids, Vcl.DBGrids,
  Vcl.StdCtrls, Vcl.Buttons, Vcl.ExtCtrls;

type
  Tfm_pesq_for = class(TForm)
    Panel1: TPanel;
    Panel2: TPanel;
    Panel3: TPanel;
    lbl_item: TLabel;
    rdg_opcao: TRadioGroup;
    edt_descricao: TEdit;
    btn_loc: TBitBtn;
    Panel4: TPanel;
    BitBtn1: TBitBtn;
    Panel5: TPanel;
    Data_for: TDataSource;
    DBGrid1: TDBGrid;
    BitBtn2: TBitBtn;
    procedure btn_locClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fm_pesq_for: Tfm_pesq_for;

implementation

{$R *.dfm}

uses U_dm_principal, U_fm_produto;

procedure Tfm_pesq_for.btn_locClick(Sender: TObject);
begin
       dm_principal.cds_fornecedor.Close;
       dm_principal.sq_fornecedor.SQL.Text:= 'select f.id,'
                                            +#13+'f.regiao,'
                                            +#13+'f.forma_pagamento,'
                                            +#13+'f.data_ultima_compra,'
                                            +#13+'f.valor_ultima_compra,'
                                            +#13+'f.conta_credito,'
                                            +#13+'f.conta_debito,'
                                            +#13+'f.limite_credito,'
                                            +#13+'f.cep,'
                                            +#13+'f.tipo_logradouro,'
                                            +#13+'f.numero,'
                                            +#13+'f.bairro,'
                                            +#13+'f.municipio,'
                                            +#13+'f.data,'
                                            +#13+'f.hora,'
                                            +#13+'f.vendedor,'
                                            +#13+'f.pai,'
                                            +#13+'f.mae,'
                                            +#13+'f.desconto_maximo,'
                                            +#13+'f.ie, f.nome,'
                                            +#13+'f.apelido,'
                                            +#13+'f.tipo_pessoa,'
                                            +#13+'f.cpf,'
                                            +#13+'f.rg,'
                                            +#13+'f.dt_nascimento,'
                                            +#13+'f.regime_tributario,'
                                            +#13+'f.porte_pessoa_juridica,'
                                            +#13+'f.tipo_atividade,'
                                            +#13+'f.tipo_contribuinte,'
                                            +#13+'f.logradouro,'
                                            +#13+'f.complemento,'
                                            +#13+'f.ddd1,'
                                            +#13+'f.ddd2,'
                                            +#13+'f.telefone1,'
                                            +#13+'f.telefone2,'
                                            +#13+'f.obs,'
                                            +#13+'f.home_page,'
                                            +#13+'f.e_mail,'
                                            +#13+'f.tabela_preco,'
                                            +#13+'f.status,'
                                            +#13+'f.uf'
                                            +#13+'from fornecedor f'
                                            +#13+' where f.nome <> ' + QuotedStr('') ;
         if  length(trim(edt_descricao.Text))>0 then
             dm_principal.sq_fornecedor.SQL.Add(' and  f.nome containing '+QuotedStr(edt_descricao.Text));
             dm_principal.cds_fornecedor.open;
end;

procedure Tfm_pesq_for.FormShow(Sender: TObject);
begin
 dm_principal.cds_fornecedor.Open;
end;

end.
